
import { PNT, setNavBarTitle, showToast, shopUrl, formatLeftTime, getCurrentPageUrl, pushPagePath, formatTime } from "../../utils/utils";
import { Team } from '../../utils/apis';
var app = getApp();
Page({
  data: {
    winHeight: "",//窗口高度
    currentTab: 0, //预设当前项的值
    scrollLeft: 0, //tab标题的滚动条位置
    expertList: [
      [
      { 
        img: "https://donglongshangshi.oss-cn-beijing.aliyuncs.com/images/201703/goods_img/0_G_1490147626763.jpg",
        name: "Galanz/格兰仕 G80F23CN3L-C2(R0)正品微波炉23L 智能光波炉家用 800w速热23升容量1级能效智能预约",
      shop_price:100.00,
      tj:50.00,
      people: 2,
     
    },
      {
        img: "https://donglongshangshi.oss-cn-beijing.aliyuncs.com/images/201703/goods_img/0_G_1490147626763.jpg",
        name: "张三",
        tag: "知名情感博主",
        answer: 134,
        listen: 2234
      },
    
    ],
    [
      {
        img: "https://donglongshangshi.oss-cn-beijing.aliyuncs.com/images/201703/goods_img/0_G_1490147626763.jpg",
        name: "Galanz/格兰仕 G80F23CN3L-C2(R0)正品微波炉23L 智能光波炉家用 800w速热23升容量1级能效智能预约",
        shop_price: 100.00,
        tj: 50.00,
        people: 2,

      }, 
    ],
  ],
  team:[],
  },
  // 滚动切换标签样式
  switchTab: function (e) {
    this.setData({
      currentTab: e.detail.current
    });
    this.checkCor();
  },
  // 点击标题切换当前页时改变样式
  swichNav: function (e) {
    var cur = e.target.dataset.current;
    if (this.data.currentTaB == cur) { return false; }
    else {
      this.setData({
        currentTab: cur
      })
    }
  },
  //判断当前滚动超过一屏时，设置tab标题滚动条。
  checkCor: function () {
    if (this.data.currentTab > 4) {
      this.setData({
        scrollLeft: 300
      })
    } else {
      this.setData({
        scrollLeft: 0
      })
    }
  },
  onLoad: function () {
    var that = this;
    // 高度自适应
    wx.getSystemInfo({
      success: function (res) {
        var clientHeight = res.windowHeight,
          clientWidth = res.windowWidth,
          rpxR = 750 / clientWidth;
        var calc = clientHeight * rpxR - 180;
        console.log(calc)
        that.setData({
          winHeight: calc
        });
      }
    });
    this.team();
  },

  tiaozhuan:function(e){
    wx.navigateTo({
      url: '/pages/team/detail?id='+e.currentTarget.dataset.id,
    })
  },
  team(){
    Team({}).then(res=>{
      if(res.data.length > 0){
        this.setData({
          team:res.data,
        })
      }
    })
  }
})